package student.aistar.day14.enums;

public enum  Season {
    //枚举类型中是可以存在抽象方法的, 但是每个枚举常量必须要实现这个抽象方法
    SPRING("春天"){
        @Override
        public Season next() {
            return Season.SUMMER;
        }
    },
    SUMMER("夏天") {
        @Override
        public Season next() {
            return Season.AUTUMN;
        }
    },
    AUTUMN("秋天") {
        @Override
        public Season next() {
            return Season.WINTER;
        }
    },
    WINTER("冬天") {
        @Override
        public Season next() {
            return Season.SPRING;
        }
    };
    private String sign;

    Season(String sign) {
        this.sign = sign;
    }

    public String getSign() {
        return sign;
    }

    public abstract Season next();
}
class TestSeason{
    public static void main(String[] args) {
        Season s = Season.SPRING;
        for(;;){
            System.out.println(s+"-"+s.getSign());
            try {
                //让程序睡一秒钟
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            s = s.next();
        }
    }
}